(function($){
    $(function(){
		
		$("form").keyup(function (e) {  
			if(e.keyCode == 13){
				return false; 
			}  
		})  
		
		
		if ( $("#social_register_validate").length > 0 ) { 

			$("#social_register_validate").validate({
				errorElement: "span", 
				rules: {
					'tx_mfwcsociallogin_weibo[bind][username]': {
						required: true,
					},
					'tx_mfwcsociallogin_weibo[bind][password]': {
						required: true,
					},
					'tx_mfwcsociallogin_weibo[bind][name]': {
						required: true,
					},
					'tx_mfwcsociallogin_weibo[bind][telephone]': {
						required: true,
						isTel: true,
					},
					'tx_mfwcsociallogin_weibo[bind][email]': {
						required: true,
						email: true,
					},
					
					'tx_mfwcsociallogin_qq[bind][username]': {
						required: true,
					},
					'tx_mfwcsociallogin_qq[bind][password]': {
						required: true,
					},
					'tx_mfwcsociallogin_qq[bind][name]': {
						required: true,
					},
					'tx_mfwcsociallogin_qq[bind][telephone]': {
						required: true,
						isTel: true,
					},
					'tx_mfwcsociallogin_qq[bind][email]': {
						required: true,
						email: true,
					},
					
					'tx_mfwcsociallogin_wechat[bind][username]': {
						required: true,
					},
					'tx_mfwcsociallogin_wechat[bind][password]': {
						required: true,
					},
					'tx_mfwcsociallogin_wechat[bind][name]': {
						required: true,
					},
					'tx_mfwcsociallogin_wechat[bind][telephone]': {
						required: true,
						isTel: true,
					},
					'tx_mfwcsociallogin_wechat[bind][email]': {
						required: true,
						email: true,
					},
				},
				errorPlacement: function(error, element) {  
					error.appendTo(element.parent());  
				},
				highlight : function(element) {
					$(element).closest('.form-group').addClass('has-error');
				},
				success : function(label) {
					label.closest('.form-group').removeClass('has-error');
					label.remove();
				},
			});
		}
    });
	
})(jQuery);